//
//  AppDelegate.swift
//  DataModelGenerationTool
//
//  Created by 皮蛋菌 on 2025/6/23.
//

import Cocoa
import Foundation

@main
class AppDelegate: NSObject, NSApplicationDelegate {

    // 应用程序的主窗口
    var window: NSWindow!


    func applicationDidFinishLaunching(_ aNotification: Notification) {
        // Insert code here to initialize your application
        NSApplication.shared.windows.forEach { $0.close() }
        
        window = NSWindow(contentRect: NSRect(x: 0, y: 0, width: 1200, height: 900), styleMask: [.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)
  
        window.title = "JSON 数据模型生成器"

        window.minSize = NSSize(width: 800, height: 600)

        window.center()

        window.backgroundColor = NSColor.windowBackgroundColor

        let viewController = ViewController()
        window.contentViewController = viewController


        window.makeKeyAndOrderFront(nil)
    }

    func applicationWillTerminate(_ aNotification: Notification) {
        // Insert code here to tear down your application
    }

    func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
        return true
    }


}

